home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / utils / gredarc / vga.h < prev   
C/C++ Source or Header  |  1993-03-07  |  8KB  |  428 lines

  1. /***********************************************************
  2. VGA.H
  3.  
  4. March 1, 1993
  5. R. Dobbins
  6. ***********************************************************/
  7.  
  8.  
  9. /* Your application begins with this function.  The MAIN
  10.    function is in the GID library and handles all of the
  11.    startup responsibilities.  */
  12.  
  13.  
  14. void app_start(int argc, unsigned char *argv[]);
  15.  
  16. /* IMAGPRIM.C  defines for the monitor types */
  17.  
  18. #define MONO        0
  19. #define CGA            1
  20. #define EGAMONO    2
  21. #define EGA            3
  22. #define MCGA        4
  23. #define VGAMONO    5
  24. #define VGA            6
  25.  
  26. /* the mode this library will operate in */
  27.  
  28. #define VGA256MODE 0x13
  29.  
  30.  
  31.  
  32. /* IMAGMAIN.C  */
  33.  
  34.  
  35.  
  36. typedef struct image_st
  37.     {
  38.     unsigned char *data;
  39.     int row;
  40.     int col;
  41.     int height;
  42.     int width;
  43.     unsigned char level;
  44.     struct image_st *prev;
  45.     struct image_st *next;
  46.     } IMAGE_ST;
  47.  
  48.  
  49. #define IMAGESZ sizeof(IMAGE_ST)
  50.  
  51.  
  52. typedef struct _imagehdr
  53.     {
  54.     int height;
  55.     int width;
  56.     int qty;
  57.     } IMAGE_HEADER;
  58.  
  59.  
  60. #define HDRSZ sizeof(IMAGE_HEADER)
  61. #define HDRSZL (long) sizeof(IMAGE_HEADER)
  62.  
  63.  
  64. typedef struct _rply_img
  65.     {
  66.     unsigned char *image_data;
  67.     struct _rply_img *prev;
  68.     struct _rply_img *next;
  69.     } REPLAY_IMG;
  70.  
  71.  
  72. #define REPLAYSZ sizeof(REPLAY_IMG)
  73.  
  74.  
  75. #define NUMFONT 4
  76.  
  77.  
  78. #ifdef IMAGMAIN
  79.  
  80.     int goterr = 0;
  81.  
  82.     unsigned char *nomerr = "Insufficient Memory";
  83.  
  84.     IMAGE_ST *first_img;
  85.     IMAGE_ST *temp_img;
  86.     IMAGE_ST *new_img;
  87.     IMAGE_ST *curr_img;
  88.  
  89.     double onesec;
  90.  
  91.     IMAGE_HEADER image_header;
  92.  
  93.     unsigned char *vgamask;
  94.     unsigned char *vgascrn;
  95.  
  96.     unsigned char bootmode;
  97.     unsigned int statusport;
  98.     unsigned int allcode;
  99.     int screen_loaded = 0;
  100.  
  101.     unsigned char *font_buff[NUMFONT];
  102.     int font_height[NUMFONT];
  103.  
  104.     unsigned char *image_data;
  105.     int curr_image_record;
  106.  
  107. #else
  108.  
  109.     extern int goterr;
  110.  
  111.     extern unsigned char *nomerr;
  112.  
  113.     extern unsigned char bootmode;
  114.     extern unsigned int statusport;
  115.     extern unsigned int allcode;
  116.     extern int screen_loaded;
  117.  
  118.     extern unsigned char *font_buff[NUMFONT];
  119.     extern int font_height[NUMFONT];
  120.  
  121.     extern IMAGE_ST *first_img;
  122.     extern IMAGE_ST *temp_img;
  123.     extern IMAGE_ST *new_img;
  124.     extern IMAGE_ST *curr_img;
  125.  
  126.     extern double onesec;
  127.  
  128.     extern IMAGE_HEADER image_header;
  129.  
  130.     extern unsigned char *vgamask;
  131.     extern unsigned char *vgascrn;
  132.  
  133.     extern unsigned char *image_data;
  134.     extern int curr_image_record;
  135.  
  136. #endif
  137.  
  138.  
  139. void getkey(void);
  140.  
  141.  
  142.  
  143.  
  144. /* IMAGFONT.C  */
  145.  
  146.  
  147. unsigned char *load_font(unsigned char *ffile,
  148.                                                     int *fonthi);
  149.  
  150. int saystr(int row,
  151.                         int col,
  152.                         unsigned char *say,
  153.                         unsigned char *font,
  154.                         int fhi,
  155.                         unsigned char fgd,
  156.                         unsigned char bkd,
  157.                         int clrto);
  158.  
  159. int save_area(int row,
  160.                             int col,
  161.                             int height,
  162.                             int width);
  163.  
  164. void restore_last(void);
  165.  
  166. void tellerr(unsigned char *say);
  167.  
  168.  
  169. /* IMAGPRIM.C  */
  170.  
  171.  
  172.  
  173. int get_adapter(void);
  174.  
  175. void clrarea(    int srow,
  176.                             int scol,
  177.                             int height,
  178.                             int width,
  179.                             unsigned char scolor);
  180.  
  181. void setvidmode(unsigned char mmode);
  182.  
  183. unsigned int calcaddr(int row, int col);
  184.  
  185. void q_putpix(unsigned int addr, unsigned char mcolor);
  186.  
  187. void putpix1(int row, int col, unsigned char mcolor);
  188.  
  189. unsigned char getpix(int row, int col);
  190.  
  191. void clrall(unsigned char scolor);
  192.  
  193. void put_hline(    int row,
  194.                             int col,
  195.                             int llen,
  196.                             unsigned char scolor);
  197.  
  198. void put_vline(    int row,
  199.                                 int col,
  200.                                 int llen,
  201.                                 unsigned char scolor);
  202.  
  203. void box(    int row,
  204.                     int col,
  205.                     int height,
  206.                     int width,
  207.                     unsigned char mco);
  208.  
  209. void clrarea(    int srow,
  210.                             int scol,
  211.                             int height,
  212.                             int width,
  213.                             unsigned char scolor);
  214.  
  215.  
  216. void colors_black(void);
  217.  
  218. void fade_in(void);
  219. void fade_out(void);
  220.  
  221.  
  222. /* IMAGSHOW.C  */
  223.  
  224.  
  225. int alloc_screens(void);
  226.  
  227. void dealloc_screens(void);
  228.  
  229. void dealloc_all_images(void);
  230.  
  231. void initscrn(void);
  232.  
  233. void initmask(void);
  234.  
  235. void showscrn(void);
  236.  
  237. IMAGE_ST *append_image(    unsigned char *idata,
  238.                                                 int row,
  239.                                                 int col,
  240.                                                 int height,
  241.                                                 int width,
  242.                                                 unsigned char level);
  243.  
  244. unsigned char restfrom(    int row,
  245.                                                 int col,
  246.                                                 unsigned char lvl,
  247.                                                 unsigned int addr);
  248.  
  249. void movefrom(    int row,
  250.                                 int col,
  251.                                 unsigned char lvl,
  252.                                 unsigned char newlvl,
  253.                                 unsigned int addr);
  254.  
  255.  
  256. void change_level(    unsigned char *idata,
  257.                                         int row,
  258.                                         int col,
  259.                                         int height,
  260.                                         int width,
  261.                                         unsigned char lvl,
  262.                                         unsigned char newlvl);
  263.  
  264. void restimage(unsigned char *idata,
  265.                             unsigned char lvl,
  266.                             int row,
  267.                             int col,
  268.                             int height,
  269.                             int width);
  270.  
  271. void showimage(unsigned char *idata,
  272.                             unsigned char lvl,
  273.                             int row,
  274.                             int col,
  275.                             int height,
  276.                             int width);
  277.  
  278. int load_scrn(unsigned char *fname);
  279.  
  280.  
  281.  
  282. /* IMAGMOVE.C  */
  283.  
  284. #define M_UP                0
  285. #define M_UPRIGHT        1
  286. #define M_RIGHT            2
  287. #define M_DNRIGHT        3
  288. #define M_DOWN            4
  289. #define M_DNLEFT        5
  290. #define M_LEFT            6
  291. #define M_UPLEFT        7
  292. #define M_NOMOVE        8
  293.  
  294.  
  295.  
  296. void moveimageright(    unsigned char *image,
  297.                                         int row,
  298.                                         int col,
  299.                                         int height,
  300.                                         int width,
  301.                                         unsigned char lvl);
  302.  
  303. void moveimageleft(unsigned char *image,
  304.                                     int row,
  305.                                     int col,
  306.                                     int height,
  307.                                     int width,
  308.                                     unsigned char lvl);
  309.  
  310. void moveimageup(unsigned char *image,
  311.                                 int row,
  312.                                 int col,
  313.                                 int height,
  314.                                 int width,
  315.                                 unsigned char lvl);
  316.  
  317. void moveimagedown(unsigned char *image,
  318.                                     int row,
  319.                                     int col,
  320.                                     int height,
  321.                                     int width,
  322.                                     unsigned char lvl);
  323.  
  324. void moveimageupleft(unsigned char *image,
  325.                                         int row,
  326.                                         int col,
  327.                                         int height,
  328.                                         int width,
  329.                                         unsigned char lvl);
  330.  
  331. void moveimageupright(unsigned char *image,
  332.                                         int row,
  333.                                         int col,
  334.                                         int height,
  335.                                         int width,
  336.                                         unsigned char lvl);
  337.  
  338. void moveimagedownleft(unsigned char *image,
  339.                                             int row,
  340.                                             int col,
  341.                                             int height,
  342.                                             int width,
  343.                                             unsigned char lvl);
  344.  
  345. void moveimagedownright(unsigned char *image,
  346.                                             int row,
  347.                                             int col,
  348.                                             int height,
  349.                                             int width,
  350.                                             unsigned char lvl);
  351.  
  352. void nomoveimage(    unsigned char *image,
  353.                                     int row,
  354.                                     int col,
  355.                                     int height,
  356.                                     int width,
  357.                                     unsigned char lvl);
  358.  
  359.  
  360. void check_move(IMAGE_ST *icurr, int mdir);
  361.  
  362.  
  363. /* IMAGDB.C  */
  364.  
  365. void dealloc_imagedata(void);
  366.  
  367. int allocate_imagedata(int height, int width);
  368.  
  369. int read_image_data(int recnum);
  370.  
  371. int open_imagefile(unsigned char *fname);
  372.  
  373. int close_imagefile(void);
  374.  
  375. void dealloc_seq(REPLAY_IMG *dealloc_first);
  376.  
  377. REPLAY_IMG *load_sequence(unsigned char *fname);
  378.  
  379.  
  380. /* IMAGPAL.C  */
  381.  
  382.  
  383. int load_palette(unsigned char *fname, int setpal);
  384.  
  385.  
  386. /* IMAGTIME.C  */
  387.  
  388. void wait_to(long waitcnt);
  389. int getcomputerspeed(void);
  390.  
  391.  
  392.  
  393. /* SETPAL.ASM */
  394.  
  395. void write_palette(char far *palbuf, int numcolrs, int start_idx);
  396.  
  397.  
  398. /* IMAGSPKR.ASM  */
  399.  
  400.  
  401. void speaker_on(unsigned int note1b,
  402.                                 unsigned int note1a,
  403.                                 unsigned int oldportval);
  404.  
  405.  
  406. /* IMAGPLAY.C  */
  407.  
  408.  
  409. typedef struct
  410.     {
  411.     unsigned char notenum;
  412.     unsigned char regnum;
  413.     unsigned char duration;
  414.     } NOTE_ST;
  415.  
  416.  
  417. void start_music(NOTE_ST *usermusic, unsigned int maxn);
  418. void suspend_music(void);
  419. void continue_music(void);
  420. void quit_music(void);
  421.  
  422.  
  423. /* IMAGPAN.ASM  */
  424.  
  425. void pan_screen(int horiz, int vert);
  426.  
  427.  
  428.